/**
 * @Author bian
 * @CreateDate 2017.3.3
 */
import { combineReducers } from "redux"
import { GETCOURSE, AJAXERROR} from "../../actions/user/course_video_actions"

require("../toastr")

var initialState = {
    course : {}
}

function courseVideo(state = initialState,action){
    switch(action.type){
        case GETCOURSE:
            var course = action.course
            console.log(course)
            return Object.assign({},state,{
                course : course
            })

        case AJAXERROR:
            toastr.error("网络错误")
            return state

        default:
            return state
    }
}

const courseVideoApp = combineReducers({       // 组装处理函数
    courseVideo
})

export default courseVideoApp